/* ScribeHow Content Styles */

/* 录制时的body样式 */
body.scribehow-recording {
  transition: margin-right 0.3s ease;
}

body.scribehow-body-shifted {
  margin-right: 400px !important;
  transition: margin-right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 侧边栏样式 */
.scribehow-sidebar {
  position: fixed;
  top: 16px;
  right: -400px;
  width: 360px;
  height: calc(100vh - 32px);
  background: #ffffff;
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.scribehow-sidebar-visible {
  right: 0;
}

/* 侧边栏头部 */
.scribehow-sidebar-header {
  padding: 24px 24px 20px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
}

.scribehow-sidebar-header h3 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  position: relative;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scribehow-sidebar-header h3::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  background: #6366f1;
  border-radius: 4px;
  flex-shrink: 0;
}

/* 录制指示器 */
.scribehow-recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.scribehow-recording-dot {
  width: 6px;
  height: 6px;
  background: #6366f1;
  border-radius: 50%;
  animation: simplePulse 2s infinite;
}

@keyframes simplePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 暂停状态的录制指示器 */
.scribehow-recording-indicator.paused .scribehow-recording-dot {
  background: #f59e0b;
  animation: none; /* 停止脉冲动画 */
}

.scribehow-recording-indicator.paused {
  color: #f59e0b;
}



/* 步骤容器 */
.scribehow-steps-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #ffffff;
}

/* 步骤项 */
.scribehow-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
  transition: all 0.2s ease;
  position: relative;
  animation: scribehow-slideIn 0.3s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

@keyframes scribehow-slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scribehow-step:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.scribehow-step.latest {
  border-color: var(--highlight-color, #ff5252);
  background: var(--highlight-bg, rgba(255, 82, 82, 0.08));
  box-shadow: 
    0 0 0 1px var(--highlight-color, #ff5252),
    0 4px 12px var(--highlight-bg, rgba(255, 82, 82, 0.2)),
    0 8px 24px var(--highlight-bg, rgba(255, 82, 82, 0.1));
  position: relative;
}

/* 新步骤边框颜色通过CSS变量动态设置 */
.scribehow-step.latest::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--highlight-color, #ff5252);
  border-radius: 0 4px 4px 0;
  animation: slideGlow 2s ease-in-out infinite;
}

.scribehow-step.latest::after {
  content: 'NEW';
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--highlight-color, #ff5252);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  animation: fadeIn 0.5s ease;
}

@keyframes slideGlow {
  0%, 100% { 
    opacity: 0.8; 
    filter: brightness(1) drop-shadow(0 0 8px var(--highlight-color, #ff5252));
  }
  50% { 
    opacity: 1; 
    filter: brightness(1.1) drop-shadow(0 0 16px var(--highlight-color, #ff5252));
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.scribehow-step-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

/* 步骤编号 */
.scribehow-step-number {
  width: 28px;
  height: 28px;
  background: #6366f1;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

/* 步骤内容 */
.scribehow-step-content {
  flex: 1;
  min-width: 0;
}

.scribehow-step-action {
  font-size: 12px;
  font-weight: 600;
  color: #6366f1;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.scribehow-step-description {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
  word-break: break-word;
  font-weight: 500;
  margin-bottom: 8px;
}

.scribehow-step-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #9ca3af;
}

.scribehow-step-time {
  font-weight: 500;
}

/* 步骤截图 */
.scribehow-step-screenshot {
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #f1f5f9;
  background: #f8fafc;
  position: relative;
}

.scribehow-step-screenshot img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 180px;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.scribehow-step-screenshot:hover img {
  transform: scale(1.02);
}

.scribehow-step-screenshot::before {
  content: '🔍 Click to expand';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  font-size: 11px;
  font-weight: 500;
  padding: 8px 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.scribehow-step-screenshot:hover::before {
  opacity: 1;
}

img.screenshot-preview {
  cursor: pointer;
  transition: all 0.2s ease;
}

img.screenshot-preview:hover {
  transform: scale(1.02);
}

.scribehow-step-screenshot:hover {
  border-color: #6366f1;
}

/* 截图加载状态 */
.scribehow-step-loading {
  margin-top: 12px;
  padding: 16px;
  text-align: center;
  background: #f8fafc;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  color: #6b7280;
  font-size: 13px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 侧边栏底部 */
.scribehow-sidebar-footer {
  padding: 24px;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
}

/* 控制按钮容器 */
.scribehow-controls {
  display: flex;
  gap: 12px;
}

/* 按钮样式 */
.scribehow-btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.scribehow-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.scribehow-btn:active::before {
  width: 300px;
  height: 300px;
}

/* 暂停按钮样式 */
.scribehow-btn-pause {
  background: #f59e0b;
  color: white;
}

.scribehow-btn-pause svg {
  width: 16px;
  height: 16px;
  fill: white;
}

.scribehow-btn-pause:hover {
  background: #d97706;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.scribehow-btn-pause:active {
  background: #b45309;
}

/* 继续按钮样式 */
.scribehow-btn-resume {
  background: #10b981;
  color: white;
}

.scribehow-btn-resume svg {
  width: 16px;
  height: 16px;
  fill: white;
}

.scribehow-btn-resume:hover {
  background: #059669;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.scribehow-btn-resume:active {
  background: #047857;
}

/* 停止按钮样式 */
.scribehow-btn-stop {
  background: #ef4444;
  color: white;
}

.scribehow-btn-stop svg {
  width: 16px;
  height: 16px;
  fill: white;
}

.scribehow-btn-stop:hover {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.scribehow-btn-stop:active {
  background: #b91c1c;
}

/* 高亮覆盖层 - 颜色通过JavaScript动态设置 */
.scribehow-highlight-overlay {
  border: 3px solid #ff5252;
  background: rgba(255, 82, 82, 0.08);
  box-shadow: 0 4px 12px rgba(255, 82, 82, 0.3);
}

/* 滚动条美化 */
.scribehow-steps-container::-webkit-scrollbar {
  width: 4px;
}

.scribehow-steps-container::-webkit-scrollbar-track {
  background: transparent;
}

.scribehow-steps-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.scribehow-steps-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 160px;
  text-align: center;
  padding: 32px 20px;
}

.empty-icon {
  margin-bottom: 16px;
  color: #d1d5db;
}

.empty-text {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.empty-subtext {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.4;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .scribehow-sidebar {
    width: calc(100% - 32px);
    right: -100%;
    top: 16px;
    height: calc(100vh - 32px);
  }
  
  .scribehow-sidebar-visible {
    right: 0;
  }
  
  .scribehow-sidebar-header {
    padding: 28px 24px;
  }
  
  .scribehow-sidebar-footer {
    padding: 24px 24px 28px;
  }
  
  .scribehow-steps-container {
    padding: 24px 20px;
  }
  
  .scribehow-step {
    padding: 20px;
    margin-bottom: 20px;
  }
  
  .scribehow-step-number {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  body.scribehow-body-shifted {
    margin-right: 0 !important;
  }
}

/* 防止与页面样式冲突 */
.scribehow-sidebar * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.scribehow-sidebar *:not(input):not(textarea) {
  user-select: none;
}
